﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace WpfUMLTry1.Model.Quest
{
    class QuestChooseTxt : AbstractQuest
    {
        private Int32 _numberfOptions;
        private List<BasicAnswer> answerOptions;
        private String _textOfQuest;

        public Int32 numberOfOptions
        {
            get { return _numberfOptions; }
        }
        public String textOfQuest
        {
            get { return _textOfQuest; }
            set { _textOfQuest = value; }
        }

        public String getAnwserText(Int32 index)
        {
            if(index > answerOptions.Count())
                return "Error";
            return answerOptions[index].text;
        }
        public Int32 getAnswerVal(Int32 index)
        {
            if (index > answerOptions.Count())
                return -5;
            return answerOptions[index].val;
        }

        public QuestChooseTxt(Int32 _id, Model.gameModel gmod)
            : base(_id, gmod)
        {
            answerOptions = new List<BasicAnswer>();
            state = 0;
        }

        public void addNewAnswer(String text, Int32 val)
        {
            answerOptions.Add(new BasicAnswer(text, val));
            ++_numberfOptions;
           
        }

        public void answerChoose(Int32 ans)
        {
            OnAnswerChosed(ans);
        }

        public override void startQuest(Int32 state)
        {
            View.Switcher.Switch(new View.QuestChooseTxt(), new ViewModel.QuestChooseTxt_VM(this));
        }

    }
}
